import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from '../views/login/Login.vue';
import Home from '../views/home/Home.vue';

import WriteBlog from '../views/blogs/WriteBlog';
import AllBlogs from '../views/blogs/AllBlogs';
import CategoryBlog from '../views/blogs/CategoryBlog';
import TagBlog from '../views/blogs/TagBlog';
import CommentBlog from '../views/blogs/CommentBlog';
import LinksBlog from '../views/blogs/LinksBlog';
import EditBlog from '../views/blogs/EditBlog';
import User from '../views/user/Index.vue';
import Role from '../views/role/Index.vue';
import Resource from '../views/resource/Index.vue'

Vue.use(VueRouter);

const routes = [
	{ path: '/', name: 'home', component: Home, hidden: true },

	{ path: '/login', name: 'Login', component: Login, hidden: true },

	{
		path: '/blog',
		name: '博客管理',
		component: Home,
		children: [
			{ path: '/blog/writeblog', name: '写博客', component: WriteBlog },
			{ path: '/blog/editblog/:id', name: '编辑博客', component: EditBlog, props: true, hidden: true },
			{ path: '/blog/allblogs', name: '文章管理', component: AllBlogs },
			{ path: '/blog/categoryblog', name: '分类管理', component: CategoryBlog },
			{ path: '/blog/tagblog', name: '标签管理', component: TagBlog },
			{ path: '/blog/commentblog', name: '评论管理', component: CommentBlog },
			{ path: '/blog/linksblog', name: '友链管理', component: LinksBlog }
		]
	},
	{
		path: 'user',
		name: '用户管理',
		component: Home,
		children: [
			{ path: '/user/list', name: '用户列表', component: User },
			{ path: '/role/list', name: '角色列表', component: Role },
			{ path: '/resource/list', name: '资源管理', component: Resource }
		]
	}
];
const router = new VueRouter({
	mode:"history",
	routes
});

export default router;
